/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.wii.elpro.dao.jpa;

import com.wii.elpro.dao.JPAUtil;
import com.wii.elpro.dao.ProductSpecificationInterface;
import com.wii.elpro.entity.ProductSpecification;
import java.util.List;
import javax.persistence.EntityManager;

/**
 *
 * @author hendro
 */
public class ProductSpecificationImpl extends DAOGenericImpl implements ProductSpecificationInterface{

    public ProductSpecification getProductSpecification(long id) throws Exception {
        JPAUtil.beginTransaction();
        EntityManager em = JPAUtil.getEntityManager();
        try {
            return em.find(ProductSpecification.class, id);
        } catch (Exception ex) {
            throw ex;
        }
    }

    public List<ProductSpecification> getProductSpecifications() throws Exception {
        JPAUtil.beginTransaction();
        EntityManager em = JPAUtil.getEntityManager();
        try {
            return em.createQuery("SELECT d FROM ProductSpecification d").getResultList();
        } catch (Exception ex) {
            throw ex;
        }
    }

}
